package com.fmdj.customer.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.fmdj.common.util.CommonResult;
import com.fmdj.customer.controller.form.*;
import com.fmdj.customer.feign.CstServiceApi;
import com.fmdj.customer.feign.FeeCalculatorServiceApi;
import com.fmdj.customer.feign.MapServiceApi;
import com.fmdj.customer.feign.OdrServiceApi;
import com.fmdj.customer.service.CustomerService;
import com.fmdj.customer.utils.ReturnMessage;
import com.fmdj.mps.controller.form.CalculateTripDistanceAndDurationForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;

@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CstServiceApi cstServiceApi;

    @Override
    public String registerNewCustomer(RegisterNewCustomerForm form) {
        CommonResult commonResult = cstServiceApi.registerCustomer(form);
        String customerId = (String) commonResult.get(CommonResult.RETURN_USER_ID);
        return customerId;
    }

    @Override
    public Long login(LoginForm form) {
        CommonResult commonResult = cstServiceApi.login(form);
        String customerId = (String) commonResult.get(CommonResult.RETURN_USER_ID);
        return Long.parseLong(customerId);
    }

}
